home *** CD-ROM | disk | FTP | other *** search
/ Dynamic HTML Construction Kit / Dynamic HTML Construction Kit.iso / earthlink / nscomm / java40.jar / java / lang / System.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-11-03  |  3.7 KB  |  159 lines

  1. package java.lang;
  2.  
  3. import java.io.BufferedInputStream;
  4. import java.io.BufferedOutputStream;
  5. import java.io.FileDescriptor;
  6. import java.io.FileInputStream;
  7. import java.io.FileOutputStream;
  8. import java.io.InputStream;
  9. import java.io.PrintStream;
  10. import java.util.Properties;
  11.  
  12. public final class System {
  13.    // $FF: renamed from: in java.io.InputStream
  14.    public static final InputStream field_0 = nullInputStream();
  15.    public static final PrintStream out = nullPrintStream();
  16.    public static final PrintStream err = nullPrintStream();
  17.    private static SecurityManager security = new NullSecurityManager();
  18.    private static Properties props;
  19.  
  20.    private System() {
  21.    }
  22.  
  23.    public static void setIn(InputStream var0) {
  24.       checkIO();
  25.       setIn0(var0);
  26.    }
  27.  
  28.    public static void setOut(PrintStream var0) {
  29.       checkIO();
  30.       setOut0(var0);
  31.    }
  32.  
  33.    public static void setErr(PrintStream var0) {
  34.       checkIO();
  35.       setErr0(var0);
  36.    }
  37.  
  38.    private static void checkIO() {
  39.       getSecurityManager().checkExec("setio");
  40.    }
  41.  
  42.    private static native void setIn0(InputStream var0);
  43.  
  44.    private static native void setOut0(PrintStream var0);
  45.  
  46.    private static native void setErr0(PrintStream var0);
  47.  
  48.    public static void setSecurityManager(SecurityManager var0) {
  49.       if (security != null && !(security instanceof NullSecurityManager)) {
  50.          throw new SecurityException("SecurityManager already set");
  51.       } else if (var0 == null) {
  52.          throw new NullPointerException();
  53.       } else {
  54.          security = var0;
  55.          SecurityManager.setSecurityManager();
  56.       }
  57.    }
  58.  
  59.    public static SecurityManager getSecurityManager() {
  60.       return security;
  61.    }
  62.  
  63.    public static native long currentTimeMillis();
  64.  
  65.    public static native void arraycopy(Object var0, int var1, Object var2, int var3, int var4);
  66.  
  67.    public static native int identityHashCode(Object var0);
  68.  
  69.    private static native Properties initProperties(Properties var0);
  70.  
  71.    public static Properties getProperties() {
  72.       getSecurityManager().checkPropertiesAccess();
  73.       return props;
  74.    }
  75.  
  76.    public static void setProperties(Properties var0) {
  77.       getSecurityManager().checkPropertiesAccess();
  78.       props = var0;
  79.    }
  80.  
  81.    public static String getProperty(String var0) {
  82.       if (!isPropertyAllowed(var0)) {
  83.          getSecurityManager().checkPropertyAccess(var0);
  84.       }
  85.  
  86.       return props.getProperty(var0);
  87.    }
  88.  
  89.    public static String getProperty(String var0, String var1) {
  90.       if (!isPropertyAllowed(var0)) {
  91.          getSecurityManager().checkPropertyAccess(var0);
  92.       }
  93.  
  94.       return props.getProperty(var0, var1);
  95.    }
  96.  
  97.    private static boolean isPropertyAllowed(String var0) {
  98.       return "true".equalsIgnoreCase(props.getProperty(var0 + ".applet"));
  99.    }
  100.  
  101.    public static String getenv(String var0) {
  102.       throw new Error("getenv no longer supported, use properties and -D instead: " + var0);
  103.    }
  104.  
  105.    public static void exit(int var0) {
  106.       Runtime.getRuntime().exit(var0);
  107.    }
  108.  
  109.    // $FF: renamed from: gc () void
  110.    public static void method_0() {
  111.       Runtime.getRuntime().gc();
  112.    }
  113.  
  114.    public static void runFinalization() {
  115.       Runtime.getRuntime().runFinalization();
  116.    }
  117.  
  118.    public static void runFinalizersOnExit(boolean var0) {
  119.       Runtime.getRuntime();
  120.       Runtime.runFinalizersOnExit(var0);
  121.    }
  122.  
  123.    public static void load(String var0) {
  124.       getSecurityManager().checkLink(var0);
  125.       Runtime.getRuntime().load(var0);
  126.    }
  127.  
  128.    public static void loadLibrary(String var0) {
  129.       getSecurityManager().checkLink(var0);
  130.       Runtime.getRuntime().loadLibrary(var0);
  131.    }
  132.  
  133.    private static InputStream nullInputStream() throws NullPointerException {
  134.       if (currentTimeMillis() > 0L) {
  135.          return null;
  136.       } else {
  137.          throw new NullPointerException();
  138.       }
  139.    }
  140.  
  141.    private static PrintStream nullPrintStream() throws NullPointerException {
  142.       if (currentTimeMillis() > 0L) {
  143.          return null;
  144.       } else {
  145.          throw new NullPointerException();
  146.       }
  147.    }
  148.  
  149.    private static void initializeSystemClass() {
  150.       props = initProperties(new Properties());
  151.       FileInputStream var0 = new FileInputStream(FileDescriptor.in);
  152.       FileOutputStream var1 = new FileOutputStream(FileDescriptor.out);
  153.       FileOutputStream var2 = new FileOutputStream(FileDescriptor.err);
  154.       setIn0(new BufferedInputStream(var0));
  155.       setOut0(new PrintStream(new BufferedOutputStream(var1, 128), true));
  156.       setErr0(new PrintStream(new BufferedOutputStream(var2, 128), true));
  157.    }
  158. }
  159.